package com.shiliao.app;

import android.content.Context;
import android.support.multidex.MultiDex;

import com.growingio.android.sdk.collection.Configuration;
import com.growingio.android.sdk.collection.GrowingIO;
import com.shiliao.app.utils.YMConfig;
import com.tencent.android.tpush.XGIOperateCallback;
import com.tencent.android.tpush.XGPushConfig;
import com.tencent.android.tpush.XGPushManager;
import com.umeng.socialize.PlatformConfig;
import com.umeng.socialize.UMShareAPI;
import com.yimei.framework.FrameworkConfig;
import com.yimei.framework.YimeiFrameworkAppliction;
import com.yimei.framework.util.LogUtil;
import com.yimei.framework.util.SystemUtils;


/**
 * Created by yx on 2017/6/2.
 */

public class ShiliaoApplication extends YimeiFrameworkAppliction {
    @Override
    public void onCreate() {
        super.onCreate();
        FrameworkConfig.setLogEnable(YMConfig.YM_IS_DEBUG);
    }

    /**
     * app退出请使用这个安全退出方法
     */
    @Override
    public void exit() {
        //    SilentDownloadService.removeAllDownloadListener();
        super.exit();
    }

//    @Override
//    public void initApplication() {
//        super.initApplication();
//        //极光相关
////        JPushInterface.setDebugMode(YMConfig.YM_IS_RELEASE);
//  //      JPushInterface.init(this);
//    }

    @Override
    public void initApplication() {
        super.initApplication();
        //   PlatformConfig.setWeixin();
        //335bf871c59e5b08bee9fa24ee6240ee
        PlatformConfig.setWeixin(YMConfig.WEIXINKEY, YMConfig.WEIXINVALUE);
        PlatformConfig.setQQZone(YMConfig.QQKEY, YMConfig.QQVALUE);
        PlatformConfig.setSinaWeibo(YMConfig.WEIBOKEY, YMConfig.WEIBOVALUE, "http://sns.whalecloud.com");
        UMShareAPI.get(this);

        GrowingIO.startWithConfiguration(this, new Configuration()
                .useID()
                .trackAllFragments()
                .setChannel(SystemUtils.getMetaData(this, "UMENG_CHANNEL")));
        XGPushConfig.enableDebug(this,true);
        XGPushConfig.enableOtherPush(getApplicationContext(), true);
        XGPushConfig.setHuaweiDebug(true);
    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }
}
